package com.raymond;

import com.raymond.sys.entity.Service;
import com.raymond.utils.XmlUtil;

/**
 * 测试
 *
 * @author :  raymond
 * @version :  V1.0
 * @date :  2019-11-26 12:02
 */
public class Test {
    public static void main(String[] args) {
        String weChatXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<service>\n" +
                "    <SYS_HEAD>\n" +
                "        <ServiceCode>50012000005</ServiceCode>\n" +
                "        <ServiceScene>25</ServiceScene>\n" +
                "        <ConsumerId>ums</ConsumerId>\n" +
                "        <TranDate>20191122</TranDate>\n" +
                "        <TranTime>094911</TranTime>\n" +
                "    </SYS_HEAD>\n" +
                "    <BODY>\n" +
                "        <userid>JKWWR1</userid>\n" +
                "        <pwd>a6f9cf064f3dc7ec55ff74db493d4841</pwd>\n" +
                "        <timestamp>1122152500</timestamp>\n" +
                "        <timeflag>0</timeflag>\n" +
                "        <sendTime>20191119173131</sendTime>\n" +
                "        <strategyCode>T00000000003</strategyCode>\n" +
                "        <custid>wwr0001</custid>\n" +
                "        <lanxinAcct></lanxinAcct>\n" +
                "        <wechatType>1</wechatType>\n" +
                "        <appAcct>xxxx</appAcct>\n" +
                "        <emailAcct>913011301@qq.com</emailAcct>\n" +
                "        <lanxinTmplCode></lanxinTmplCode>\n" +
                "        <wechatTmplCode></wechatTmplCode>\n" +
                "        <appTmplCode>123</appTmplCode>\n" +
                "        <emailTmplCode></emailTmplCode>\n" +
                "        <smsTmplCode>dx001</smsTmplCode>\n" +
                "        <param1>param1</param1>\n" +
                "        <param2>param2</param2>\n" +
                "        <param3>param3</param3>\n" +
                "        <param4>param4</param4>\n" +
                "        <exdata>czsj</exdata>\n" +
                "        <mt>\n" +
                "            <phone>13366666666</phone>\n" +
                "            <openid>微信用户标识</openid>\n" +
                "            <email>913011301@qq.com</email>\n" +
                "            <appUser>手机app用户</appUser>\n" +
                "            <lanxUser>员工号,或手机号</lanxUser>\n" +
                "            <parameter>{'name':'王五','time':'2019/11/30'}</parameter>\n" +
                "            <wxurl>微信模板消息跳转地址</wxurl>\n" +
                "        </mt>\n" +
                "    </BODY>\n" +
                "</service>\n";
        long start = System.currentTimeMillis();
        Service service = null;
        for (int i = 0; i < 2000; i++) {
            service = XmlUtil.convertXmlStrToObject(Service.class, weChatXml);
        }
        System.out.println(System.currentTimeMillis() - start);
        System.out.println(service.getBody());
        service = XmlUtil.convertXmlFileToObject(Service.class, "G:\\weChar.xml");
        System.out.println(service);
        XmlUtil.convertToXml(service, "G:\\weChar1.xml");
    }
}
